package com.itheima.reggie.common;

import com.itheima.reggie.domain.Employee;

/**
 * @author zsk
 * @create 2022-03-04-13:07
 */
//ThreadLocal操作工具类
public class EmployeeHolder {

    //维护ThreadLocal对象
    private static ThreadLocal<Employee> threadLocal = new ThreadLocal<>();

    //放入Employee
    public static void set(Employee employee){
        threadLocal.set(employee);
    }

    //获取Employee对象
    public static Employee get(){
        return threadLocal.get();
    }

    //销毁Employee对象
    public static void remove(){
        threadLocal.remove();
    }
}
